package com.capsulode.excel.header;

import com.capsulode.excel.exception.*;
import org.apache.poi.ss.usermodel.Cell;

public interface Header<T> {

    void setIndex(int index);

    int getIndex();

    String getName();

    /**
     * Read cell to row wrapper. This method complete handle reading business, include conversion ,validation ...
     *
     * @param cell cell in Excel WorkSheet to read
     * @param row  current row wrapped object.
     * @throws CellTypeNotExpectException     the excel type of current cell is not expect.
     * @throws UnsupportedConversionException the specified type convert to is not supported.
     * @throws ConversionFailException        converter is found but conversion failed.
     * @throws ValidationFailedException      validation failed.
     * @throws ReadingProcessFailedException  user defined reading process throws exception.
     */
    void read(Cell cell, T row)
            throws CellTypeNotExpectException,
            UnsupportedConversionException,
            ConversionFailException,
            ValidationFailedException,
            ReadingProcessFailedException;
}
